extends Card


func play_on_release(card_view: CardView) -> void:
	var monster: Monster = Globals.current_monster
	var player = card_view.get_tree().get_first_node_in_group("player")
	player.play_animation("attack")
	var tween := card_view.create_tween()
	tween.tween_callback(Shake.shake.bind(monster, 16, 0.2))
	tween.tween_callback(
		func(): Events.take_damage.emit(player, monster, get_final_damage(monster.state))
	)
	#这里一定要比上面的参数大，要不然可能有线程问题，因为shake方法也是个tween实现的
	tween.tween_interval(0.31)
	await tween.finished
	Globals.player_state.anger += self.anger
	player.play_animation("default")
	card_view.play_on_release_signal_finish.emit()
	if monster != null:
		monster.state.armor_break += self.armor_break


func get_desc() -> String:
	if desc_lab == "":
		return ""
	var text = desc_lab % [self.anger, get_final_damage_str(), self.armor_break]
	return text


func get_desc_on_target(target: Monster) -> String:
	return desc_lab % [self.anger, get_final_damage_str(target.state), self.armor_break]


func init_from_csv(introduce):
	super.init_from_csv(introduce)
	self.anger = int(introduce[5])
	self.damage = int(introduce[6])
	self.armor_break = int(introduce[7])
